<template>
    <div class="cancelClass">
        <el-dialog :close-on-click-modal="false" :title="id?取消订单:''" :visible.sync="showDialog" @close="$emit('update:showCancel', false)"
                   :showCancel="showCancel" width="500px">
            <el-form v-model="remark" ref="saveChn" label-width="90px" size="mini">
                <dialog-wrapper :MaxWidth="400">
                    <el-form-item label="理由:">
                        <el-input type="textarea" :rows="5" v-model="DetailInfo.remark"
                                  placeholder="请输入备注..."></el-input>
                    </el-form-item>
                </dialog-wrapper>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="$emit('update:showCancel', false)" size="small">取 消</el-button>
                <el-button type="primary" :loading="loading" @click="CancelOrder(id)" size="small">确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
    import {getOrderList1, cancelOrder} from '@/api/index'
    import {queryFilter} from '@/utils/patch'
    import {FormartPayType, useVcode} from "../../utils/CommonJs"


    import DialogWrapper from '@/components/DialogWrapper'

    export default {
        name: "CancelRemark",
        components: {DialogWrapper},
        data() {
            return {
                showDialog: this.showCancel,
                DetailInfo: {},
                loading: false,
                remark: '',
            }
        },
        props: {
            showCancel: {
                type: Boolean,
                default: false
            },
            id: {
                type: Number
            },
            title: {
                type: Number
            }
        },
        methods: {
            CancelOrder(id) {

                useVcode(this, () => {
                    cancelOrder(id, {'remark': this.DetailInfo.remark}).then(res => {
                        if (res.status === 0) {
                            let msg = '取消 ' + id + ' 的上分申请成功！'
                            this.$message({type: 'success', message: msg, duration: 5000})
                            this.$emit('update:showCancel', false)
                        }
                    })
                })
            }
        }
    }
</script>

<style scoped>

</style>